/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@Table(name = "PLAYLISTSONG")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Playlistsong.findAll", query = "SELECT p FROM Playlistsong p"),
    @NamedQuery(name = "Playlistsong.findByPlaylistSongId", query = "SELECT p FROM Playlistsong p WHERE p.playlistSongId = :playlistSongId"),
    @NamedQuery(name = "Playlistsong.findByOrderNum", query = "SELECT p FROM Playlistsong p WHERE p.orderNum = :orderNum"),
    @NamedQuery(name = "Playlistsong.findByCreatedBy", query = "SELECT p FROM Playlistsong p WHERE p.createdBy = :createdBy"),
    @NamedQuery(name = "Playlistsong.findByCreatedDate", query = "SELECT p FROM Playlistsong p WHERE p.createdDate = :createdDate"),
    @NamedQuery(name = "Playlistsong.findByModifiedBy", query = "SELECT p FROM Playlistsong p WHERE p.modifiedBy = :modifiedBy"),
    @NamedQuery(name = "Playlistsong.findByModifiedDate", query = "SELECT p FROM Playlistsong p WHERE p.modifiedDate = :modifiedDate")})
public class Playlistsong implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "PLAYLIST_SONG_ID")
    private Long playlistSongId;
    @Basic(optional = false)
    @Column(name = "ORDER_NUM")
    private int orderNum;
    @Basic(optional = false)
    @Column(name = "CREATED_BY")
    private String createdBy;
    @Basic(optional = false)
    @Column(name = "CREATED_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createdDate;
    @Column(name = "MODIFIED_BY")
    private String modifiedBy;
    @Column(name = "MODIFIED_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date modifiedDate;
    @JoinColumn(name = "SONG_ID", referencedColumnName = "SONG_ID")
    @ManyToOne(optional = false)
    private Song songId;
    @JoinColumn(name = "PLAYLIST_ID", referencedColumnName = "PLAYLIST_ID")
    @ManyToOne(optional = false)
    private Playlist playlistId;

    public Playlistsong() {
    }

    public Playlistsong(Long playlistSongId) {
        this.playlistSongId = playlistSongId;
    }

    public Playlistsong(Long playlistSongId, int orderNum, String createdBy, Date createdDate) {
        this.playlistSongId = playlistSongId;
        this.orderNum = orderNum;
        this.createdBy = createdBy;
        this.createdDate = createdDate;
    }

    public Long getPlaylistSongId() {
        return playlistSongId;
    }

    public void setPlaylistSongId(Long playlistSongId) {
        this.playlistSongId = playlistSongId;
    }

    public int getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(int orderNum) {
        this.orderNum = orderNum;
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public String getModifiedBy() {
        return modifiedBy;
    }

    public void setModifiedBy(String modifiedBy) {
        this.modifiedBy = modifiedBy;
    }

    public Date getModifiedDate() {
        return modifiedDate;
    }

    public void setModifiedDate(Date modifiedDate) {
        this.modifiedDate = modifiedDate;
    }

    public Song getSongId() {
        return songId;
    }

    public void setSongId(Song songId) {
        this.songId = songId;
    }

    public Playlist getPlaylistId() {
        return playlistId;
    }

    public void setPlaylistId(Playlist playlistId) {
        this.playlistId = playlistId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (playlistSongId != null ? playlistSongId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Playlistsong)) {
            return false;
        }
        Playlistsong other = (Playlistsong) object;
        if ((this.playlistSongId == null && other.playlistSongId != null) || (this.playlistSongId != null && !this.playlistSongId.equals(other.playlistSongId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Model.Playlistsong[ playlistSongId=" + playlistSongId + " ]";
    }
    
}
